package com.project.base.common;


import java.io.Serializable;


public class BaseSingle<T> implements Serializable {
    private static final long serialVersionUID = 539787345411339137L;
    private T value;

    /**
     * 构造方法
     */
    public BaseSingle() {
    }

    /**
     * 构造方法
     *
     * @param value
     */
    public BaseSingle(T value) {
        this.value = value;
    }

    /**
     * <p>获取 value
     *
     * @return the value
     */
    public T getValue() {
        return value;
    }

    /**
     * <p>设置 value
     *
     * @param value the value to set
     */
    public void setValue(T value) {
        this.value = value;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return ((value == null) ? 0 : value.hashCode());
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof BaseSingle)) return false;
        BaseSingle<?> bs = (BaseSingle<?>) obj;
        return value == null ? bs.value == null : value.equals(bs.value);
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "BaseSingle [value=" + value + "]";
    }
}

